local skel = fk.CreateSkill {
  name = "lb_zero__chifeng",
}

Fk:loadTranslationTable {
  ["lb_zero__chifeng"] = "炽风",
  [":lb_zero__chifeng"] = "出牌阶段限一次，你可以失去至少1点体力，视为使用一张具有以下前等量项效果的火【杀】：1.此【杀】每次造成伤害后，你回复1点体力；2.此【杀】造成的伤害+1；3.此【杀】额外结算一次。",

  ["#lb_zero__chifeng"] = "炽风：你可以失去至少1点体力，视为使用一张具有以下前等量项效果的火【杀】：<br>1.此【杀】每次造成伤害后，你回复1点体力；2.此【杀】造成的伤害+1；3.此【杀】额外结算一次",

  ["$lb_zero__chifeng1"] = "求饶的话，下次记得提前说！",
  ["$lb_zero__chifeng2"] = "燃烧吧，赌上全部的一剑！",
  ["$lb_zero__chifeng3"] = "现在才想逃？迟了！",
}

skel:addEffect("viewas", {
  anim_type = "offensive",
  prompt = "#lb_zero__chifeng",
  interaction = function (self, player)
    return UI.Spin{
      from = 1,
      to = player.hp,
    }
  end,
  card_filter = Util.FalseFunc,
  view_as = function (self, player, cards)
    if #cards ~= 0 or not self.interaction.data then
      return nil
    end
    local card = Fk:cloneCard("fire__slash")
    card.skillName = skel.name
    return card
  end,
  before_use = function (self, player, use)
    if not self.interaction.data then return skel.name end
    local num = tonumber(self.interaction.data)
    local room = player.room
    room:loseHp(player, num, skel.name)
    use.extraUse = true
    use.extra_data = use.extra_data or {}
    use.extra_data.lb_zero__chifeng = player
    if num > 1 then
      use.additionalDamage = (use.additionalDamage or 0) + 1
    end
    if num > 2 then
      use.additionalEffect = (use.additionalEffect or 0) + 1
    end
  end,
  enabled_at_play = function (self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
  enabled_at_response = function (self, player, response)
    return not response and player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0
  end,
})

skel:addEffect(fk.Damage, {
  is_delay_effect = true,
  can_trigger = function (self, event, target, player, data)
    local parent = player.room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true) --父事件
    return parent and target == player and player:hasSkill(skel.name) and player:isWounded() and data.card == parent.data.card
    and parent.data.extra_data and parent.data.extra_data.lb_zero__chifeng == player
  end,
  on_use = function (self, event, target, player, data)
    player.room:recover{
      who = player,
      num = 1,
      skillName = skel.name,
      recoverBy = player,
    }
  end,
})

skel:addEffect("targetmod", {
  bypass_times = function (self, player, skill, scope, card, to)
    return card and table.contains(card.skillNames, skel.name)
  end,
})

return skel
